<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Model\UserInterPushRecordMaterial
 *
 * @mixin \Eloquent
 * @property int $id
 * @property string|null $user_name 用户名称
 * @property string|null $head_portrait 用户头像
 * @property string|null $cover 分享内容封面
 * @property string|null $title 分享内容标题
 * @property string|null $source_table_name 来源表名称
 * @property int|null $source_table_id 来源表id
 * @property int|null $browse_num 浏览量
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereBrowseNum($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereCover($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereHeadPortrait($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereSourceTableId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereSourceTableName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereTitle($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereUserName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial query()
 * @property int|null $record_id user_interpush_record->id
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereRecordId($value)
 * @property-read \App\Model\UserInterPushRecord $interPushRecord
 * @property-read \App\Model\UserInterPushRecord $targetInterPushRecord
 * @property string|null $source_type 来源表名称
 * @property int|null $source_id 来源表id
 * @property-read \Illuminate\Database\Eloquent\Model|\Eloquent $material
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereSourceId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereSourceType($value)
 * @property int|null $source_style 1,文章，2个人网页，3营销网页， 4名片
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereSourceStyle($value)
 * @property int|null $user_id 用户id
 * @property int|null $share_num 分享量
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereShareNum($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Model\UserInterPushRecordMaterial whereUserId($value)
 */
class UserInterPushRecordMaterial extends Model
{
    protected $table="user_interpush_record_material";

    protected $fillable=["user_name", "head_portrait", "cover", "title", "source_table_name", "source_table_id", "browse_num"];
    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function interPushRecord()
    {
       return  $this->belongsTo(UserInterPushRecord::class, "meterial_id","id");
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function targetInterPushRecord()
    {
        return $this->belongsTo(UserInterPushRecord::class, "target_meterial_id", "id");
    }

    /**
     * 多态关系(文章， 个人网页， 名片)
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
     */
    public function material()
    {
        return $this->morphTo("interPushRecordMaterial", "source_type", "source_id");
    }




}
